﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Presentation
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Se carga el view correspondiente a los privilegios del rol del usuario logueado.
            if (Session["userRole"].ToString() == "Administrator")
            {
                mvMenu.ActiveViewIndex = 1;
            }
            else if (Session["userRole"].ToString() == "Teacher")
            {
                mvMenu.ActiveViewIndex = 2;
            }
            else
            {
                mvMenu.ActiveViewIndex = 0;
            }
        }

        protected void btnLogOut_Click(object sender, EventArgs e)
        {
            Session["userId"] = -1;
            Session["userRole"] = "";
            Response.Redirect("~/Content/login.aspx");
        }
    }
}
